<?php

namespace App\Http\Controllers\API;

use App\Http\Controllers\Controller;
use App\Server\API\LoginService;
use App\Server\API\RegisterService;
use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
     * 注册接口
     */
    public function register(Request $request)
    {
        $data = $request -> only(['username','password','phone','email']);
        RegisterService::register($data);
    }
    /**
     * 账号激活
     */
    public function active(Request $request)
    {
        //获取所有参数
        $data = $request -> only('email','txt');
        $msg = RegisterService::activeEmail($data);
        return view('api.active',['msg'=>$msg]);
    }
    /**
     * 登录
     */
    public function login(Request $request)
    {
        $data = $request -> only(['username','password','tt']);
        LoginService::login($data);
    }
}
